package com.xz;

import com.xz.list.ArrayList;
import com.xz.list.List;

/**
 * @author XZ
 * @create 2021-04-23 19:46
 */
public class Stack<E> {

    private List<E> list = new ArrayList<>();

    public void push(Object element) {
        list.add((E) element);
    }


    public int size() {
        return list.size();
    }


    public boolean isEmpty() {
        return list.isEmpty();
    }

    public Object pop() {
        return list.remove(list.size() - 1);
    }


    public Object top() {
        return list.get(list.size() - 1);
    }

    public void clear() {
        list.clear();
    }

}
